keep a reference to the source buffer while the clipboard contents buffer
authorMichael Natterer <mitch@imendio.com>
Fri, 28 Apr 2006 12:13:04 +0000 (12:13 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Fri, 28 Apr 2006 12:13:04 +0000 (12:13 +0000)
2006-04-28  Michael Natterer  <mitch@imendio.com>

* gtk/gtktextbuffer.c (create_clipboard_contents_buffer): keep a
reference to the source buffer while the clipboard contents buffer
exists, because it is needed for serializing the contents buffer.
Makes copying from the contents buffer possible even after the
resp. text view is destroyed (for example when there is a
clipboard manager running on app exit) (bug #339195).

ChangeLog
ChangeLog.pre-2-10
gtk/gtktextbuffer.c

index 76737fe14a42258ac5d38e8bf94ce3e01cb1e548..1fd37f76e24c66fabb8b7f33f56e1efa815c0c1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-04-28  Michael Natterer  <mitch@imendio.com>
+
+       * gtk/gtktextbuffer.c (create_clipboard_contents_buffer): keep a
+       reference to the source buffer while the clipboard contents buffer
+       exists, because it is needed for serializing the contents buffer.
+       Makes copying from the contents buffer possible even after the
+       resp. text view is destroyed (for example when there is a
+       clipboard manager running on app exit) (bug #339195).
+
 2006-04-27  Behdad Esfahbod  <behdad@gnome.org>
 
        * gdk/gdkpango.c (gdk_pango_renderer_draw_glyphs): Cast to double
index 76737fe14a42258ac5d38e8bf94ce3e01cb1e548..1fd37f76e24c66fabb8b7f33f56e1efa815c0c1c 100644 (file)
@@ -1,3 +1,12 @@
+2006-04-28  Michael Natterer  <mitch@imendio.com>
+
+       * gtk/gtktextbuffer.c (create_clipboard_contents_buffer): keep a
+       reference to the source buffer while the clipboard contents buffer
+       exists, because it is needed for serializing the contents buffer.
+       Makes copying from the contents buffer possible even after the
+       resp. text view is destroyed (for example when there is a
+       clipboard manager running on app exit) (bug #339195).
+
 2006-04-27  Behdad Esfahbod  <behdad@gnome.org>
 
        * gdk/gdkpango.c (gdk_pango_renderer_draw_glyphs): Cast to double
index ea04b885b016599b9b49e4f954592167bcab7652..628686c8b59df39280f410eb04c00ab401272660 100644 (file)
@@ -2967,6 +2967,13 @@ create_clipboard_contents_buffer (GtkTextBuffer *buffer)
   g_object_set_data (G_OBJECT (contents), I_("gtk-text-buffer-clipboard"),
                      GINT_TO_POINTER (1));
 
+  /*  Ref the source buffer as long as the clipboard contents buffer
+   *  exists, because it's needed for serializing the contents buffer.
+   *  See http://bugzilla.gnome.org/show_bug.cgi?id=339195
+   */
+  g_object_ref (buffer);
+  g_object_weak_ref (G_OBJECT (contents), (GWeakNotify) g_object_unref, buffer);
+
   return contents;
 }